//
//  OldPhotoHomeController.m
//  OldPhoto
//
//  Created by 蓝鳍互娱 on 2024/7/29.
//
#import "OldPhotoHomeController.h"
#import "OldPhotoKnowController.h"
#import "OldPhotoWebController.h"
#import "OldPhotoUploadController.h"
#import "OldPhotoGuideView.h"
@interface OldPhotoHomeController ()
@property (nonatomic,strong) OldPhotoGuideView *oldPhotoGuideView;
@end
@implementation OldPhotoHomeController
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [OldPhotoDataManger requestOldPhotoPrice];
}
- (void)creatOldPhotoInitView{
    [super creatOldPhotoInitView];
    self.oldPhotoBgImg = @"OldPhotoHomeBg";
   
    UIImageView * oldPhotoHomeTopImgView = [[UIImageView alloc] init];
    oldPhotoHomeTopImgView.image = OldPhotoImageNamed(@"OldPhotoHomeTop");
    oldPhotoHomeTopImgView.userInteractionEnabled = true;
    [self.view addSubview:oldPhotoHomeTopImgView];
    [oldPhotoHomeTopImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@(-OldPhotoRatio(72)));
        make.top.equalTo(@(OldPhotoRatio(79)+OldPhotoTopSafeHeight));
        make.width.equalTo(@(OldPhotoRatio(270)));
        make.height.equalTo(@(OldPhotoRatio(292)));
    }];
    UIButton * oldPhotoHomeSetBtn = [[UIButton alloc] init];
    [oldPhotoHomeSetBtn setBackgroundImage:OldPhotoImageNamed(@"OldPhotoHomeSet") forState:UIControlStateNormal];
    [oldPhotoHomeSetBtn addTarget:self action:@selector(oldPhotoHomeSet) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:oldPhotoHomeSetBtn];
    [oldPhotoHomeSetBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@(-OldPhotoRatio(24)));
        make.top.equalTo(@(OldPhotoRatio(25)+OldPhotoTopSafeHeight));
        make.width.equalTo(@(OldPhotoRatio(44)));
        make.height.equalTo(@(OldPhotoRatio(44)));
    }];
    UIImageView * oldPhotoHomeCheckImgView = [[UIImageView alloc] init];
    oldPhotoHomeCheckImgView.image = OldPhotoImageNamed(@"OldPhotoHomeCheck");
    [self.view addSubview:oldPhotoHomeCheckImgView];
    [oldPhotoHomeCheckImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(OldPhotoRatio(119)));
        make.top.equalTo(@(OldPhotoRatio(279)+OldPhotoTopSafeHeight));
        make.width.equalTo(@(OldPhotoRatio(194)));
        make.height.equalTo(@(OldPhotoRatio(48)));
    }];
    UIButton * oldPhotoHomeCheckBtn = [[UIButton alloc] init];
    [oldPhotoHomeCheckBtn addTarget:self action:@selector(oldPhotoHomeCheck) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:oldPhotoHomeCheckBtn];
    [oldPhotoHomeCheckBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(OldPhotoRatio(0)));
        make.right.equalTo(@(OldPhotoRatio(0)));
        make.top.equalTo(@(OldPhotoRatio(79)+OldPhotoTopSafeHeight));
        make.height.equalTo(@(OldPhotoRatio(292)));
    }];
    UIButton * oldPhotoHomeBugBtn = [[UIButton alloc] init];
    [oldPhotoHomeBugBtn setBackgroundImage:OldPhotoImageNamed(@"OldPhotoHomeBug") forState:UIControlStateNormal];
    [oldPhotoHomeBugBtn addTarget:self action:@selector(oldPhotoHomeBug) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:oldPhotoHomeBugBtn];
    [oldPhotoHomeBugBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(OldPhotoRatio(24)));
        make.top.equalTo(oldPhotoHomeCheckBtn.mas_bottom).offset(OldPhotoRatio(94));
        make.width.equalTo(@(OldPhotoRatio(339)));
        make.height.equalTo(@(OldPhotoRatio(374)));
    }];
    UIButton * oldPhotoHomeColorBtn = [[UIButton alloc] init];
    [oldPhotoHomeColorBtn setBackgroundImage:OldPhotoImageNamed(@"OldPhotoHomeColor") forState:UIControlStateNormal];
    [oldPhotoHomeColorBtn addTarget:self action:@selector(oldPhotoHomeColor) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:oldPhotoHomeColorBtn];
    [oldPhotoHomeColorBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@(-OldPhotoRatio(24)));
        make.top.equalTo(oldPhotoHomeBugBtn);
        make.width.equalTo(@(OldPhotoRatio(339)));
        make.height.equalTo(@(OldPhotoRatio(374)));
    }];
    UIButton * oldPhotoHomePhotoBtn = [[UIButton alloc] init];
    [oldPhotoHomePhotoBtn setBackgroundImage:OldPhotoImageNamed(@"OldPhotoHomePhoto") forState:UIControlStateNormal];
    [oldPhotoHomePhotoBtn addTarget:self action:@selector(oldPhotoHomePhoto) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:oldPhotoHomePhotoBtn];
    [oldPhotoHomePhotoBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(OldPhotoRatio(24)));
        make.right.equalTo(@(-OldPhotoRatio(24)));
        make.top.equalTo(oldPhotoHomeBugBtn.mas_bottom).offset(OldPhotoRatio(24));
        make.height.equalTo(@(OldPhotoRatio(154)));
    }];
    if(![[NSUserDefaults standardUserDefaults] objectForKey:@"OldPhotoGuideDef"]){
        [self.view addSubview:self.oldPhotoGuideView];
        [self.oldPhotoGuideView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(@(OldPhotoRatio(0)));
        }];
    }
}
- (OldPhotoGuideView *)oldPhotoGuideView{
    if (!_oldPhotoGuideView) {
        _oldPhotoGuideView = [[OldPhotoGuideView alloc] init];
    }
    return _oldPhotoGuideView;
}
- (void)oldPhotoHomeCheck{
    OldPhotoKnowController *oldPhotoKnowCtrl = [[OldPhotoKnowController alloc] init];
    [self.navigationController pushViewController:oldPhotoKnowCtrl animated:true];
}
- (void)oldPhotoHomeBug{
    OldPhotoWebController * oldPhotoWebCtrl = [[OldPhotoWebController alloc] init];
    oldPhotoWebCtrl.isHidNavBack = true;
    oldPhotoWebCtrl.oldPhotoWebUrl = @"http://wenqiang.pdf.8enidt.site/lbb-h5/laozhaopian/02/repair.html";
    [self.navigationController pushViewController:oldPhotoWebCtrl animated:true];
}
- (void)oldPhotoHomeColor{
    OldPhotoWebController * oldPhotoWebCtrl = [[OldPhotoWebController alloc] init];
    oldPhotoWebCtrl.isHidNavBack = true;
    oldPhotoWebCtrl.oldPhotoWebUrl = @"http://wenqiang.pdf.8enidt.site/lbb-h5/laozhaopian/02/coloring.html";
    [self.navigationController pushViewController:oldPhotoWebCtrl animated:true];
}
- (void)oldPhotoHomePhoto{
    OldPhotoUploadController *oldPhotoUploadCtrl = [[OldPhotoUploadController alloc] init];
    [self.navigationController pushViewController:oldPhotoUploadCtrl animated:true];
}
@end
